<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use think\Db;
use think\Exception;


//use PhpOffice\PhpSpreadsheet\Writer\Xlsx;


class River extends Frontend
{
    protected $layout = 'default';

    protected $noNeedRight = ['*'];
    protected $noNeedLogin = ['*'];


    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 首页
     */
    //http://localhost:9100/index/river?id=1
    //http://mg.acciot.com.tw/index/river?id=1
    public function index()
    {
        $id = $this->request->request('id');
        $data = [];
        $jsonInfo = \app\admin\model\river\Json::where('id', $id)->find();
        if($jsonInfo)
        {
            $data = json_decode($jsonInfo['json'], true);
            //echo $jsonInfo['json'] . '<br/>';
        }

        $this->view->assign("title", "River");
        $this->view->assign("data", $data[0]);
        $this->view->assign("goodsInfo", $data[0]['goodsInfo']);
        return $this->view->fetch();
    }

}
